package errmsg

const (
	SUCCESS = 200
	ERROR   = 500

	//登陆
	LOGIN_FAIL = 1001

	//注册
	REGISTER_USERNAME_IS_USE  = 1101
	REGISTER_OK_PASSWORD_FAIL = 1102
	REGISTER_PHONE_IS_USE     = 1103
	REGISTER_EMAIL_IS_USE     = 1104
	REGISTER_PASSWORD_REQUEST = 1105
	REGISTER_INPUT_INCOMPLETE = 1106
	REGISTER_FAIL             = 1107
	REGISTER_USERNAME_IS_NULL = 1108

	//更新
	UPDATE_INFO_FAIL        = 1202
	UPDATE_PHONE_IS_NULL    = 1203
	UPDATE_EMAIL_IS_NULL    = 1204
	UPDATE_PASSWORD_IS_NULL = 1205

	//文章分类
	ARTICLE_NAME_IS_NULL = 1301
	ARTICLE_EDIT_FAIL    = 1302
	ARTICLE_NAME_IS_USE  = 1303

	//文章
	ARTICE_NAME_IS_NULL = 1401
	ARTICE_EDIT_FAIL    = 1402

	//标签
	TAG_NAME_IS_NULL = 1501
	TAG_EDIT_FAIL    = 1502
	TAG_NAME_IS_USE  = 1503

	//设置
	SETUP_EDIT_FAIL = 1601

	//评论
	COMMENT_ARTICLE_ID_IS_NULL = 1701
	COMMENT_PARENT_ID_IS_NULL  = 1702

	//TOKEN
	ERROR_TOKEN_EXIST      = 1801
	ERROR_TOKEN_RUNTIME    = 1802
	ERROR_TOKEN_WRONG      = 1803
	ERROR_TOKEN_TYPE_WRONG = 1804

	//上传
	UPLOAD_FAIL = 1901

	//资源
	RESOURCES_NAME_IS_USE = 2001

	//删除失败
	DELETE_FAIL = 4000
)

var errMsg = map[int]string{
	SUCCESS:                    "成功",
	ERROR:                      "失败",
	LOGIN_FAIL:                 "登陆失败，请检查账号（邮箱）密码是否正确！",
	REGISTER_USERNAME_IS_USE:   "用户名以被使用！",
	REGISTER_OK_PASSWORD_FAIL:  "确认密码和密码不一致！",
	REGISTER_PHONE_IS_USE:      "该手机号已被注册使用！",
	REGISTER_EMAIL_IS_USE:      "该邮箱已被注册使用！",
	REGISTER_PASSWORD_REQUEST:  "密码为空，请检查！",
	REGISTER_INPUT_INCOMPLETE:  "手机号、邮箱请至少填一个",
	REGISTER_FAIL:              "注册失败",
	REGISTER_USERNAME_IS_NULL:  "用户名为空",
	UPDATE_INFO_FAIL:           "更新失败",
	UPDATE_PHONE_IS_NULL:       "手机号不能为空",
	UPDATE_EMAIL_IS_NULL:       "邮箱不能为空",
	UPDATE_PASSWORD_IS_NULL:    "密码不能为空",
	ARTICLE_NAME_IS_NULL:       "文章分类名称为空",
	ARTICLE_EDIT_FAIL:          "文章分类编辑失败",
	ARTICLE_NAME_IS_USE:        "文章分类名称已存在",
	ARTICE_NAME_IS_NULL:        "文章名称不能为空",
	ARTICE_EDIT_FAIL:           "文章编辑失败",
	TAG_NAME_IS_NULL:           "标签名称不能为空",
	TAG_EDIT_FAIL:              "标签编辑失败",
	TAG_NAME_IS_USE:            "标签名称已存在",
	SETUP_EDIT_FAIL:            "设置编辑失败",
	COMMENT_ARTICLE_ID_IS_NULL: "缺少文章ID",
	COMMENT_PARENT_ID_IS_NULL:  "缺少父类ID",
	ERROR_TOKEN_EXIST:          "TOKEN不存在,请重新登陆",
	ERROR_TOKEN_RUNTIME:        "TOKEN已过期,请重新登陆",
	ERROR_TOKEN_WRONG:          "TOKEN不正确,请重新登陆",
	ERROR_TOKEN_TYPE_WRONG:     "TOKEN格式错误,请重新登陆",
	UPLOAD_FAIL:                "文件上传失败",
	RESOURCES_NAME_IS_USE:      "资源名称不能重复",

	DELETE_FAIL: "删除失败",
}

func GetErrMsg(code int) string {
	return errMsg[code]
}
